﻿@using Abp.MultiTenancy
@using Mes5GService.Authorization
@using Mes5GService.Editions
@model Mes5GService.Web.Areas.AppAreaName.Models.Layout.HeaderViewModel
@{
    Layout = null;
}
@if (AbpSession.MultiTenancySide != MultiTenancySides.Host)
{
    if (IsGranted(AppPermissions.Pages_Administration_Tenant_SubscriptionManagement) &&
        (Model.LoginInformations.Tenant.IsInTrialPeriod || Model.LoginInformations.Tenant.SubscriptionIsExpiringSoon(Model.SubscriptionExpireNotifyDayCount)))
    {
        if (Model.LoginInformations.Tenant.IsInTrialPeriod && !Model.LoginInformations.Tenant.SubscriptionIsExpiringSoon(Model.SubscriptionExpireNotifyDayCount))
        {
            <a href="@Url.Action("Buy", "Payment", new { area = "", editionId = Model.LoginInformations.Tenant.Edition.Id, editionPaymentType = EditionPaymentType.BuyNow })">
                <span class="glowing">
                    <i class="fa fa-exclamation-triangle"></i> @Html.Raw(L("TrialSubscriptionNotification", "<strong>" + Model.LoginInformations.Tenant.Edition.DisplayName + "</strong>", L("ClickHere")))
                </span>
            </a>
        }
        if (Model.LoginInformations.Tenant.SubscriptionIsExpiringSoon(Model.SubscriptionExpireNotifyDayCount))
        {
            <a href="@Url.Action("Index", "SubscriptionManagement", new {area = "AppAreaName"})">
                <span class="glowing">
                    <i class="fa fa-exclamation-triangle"></i> @L(Model.LoginInformations.Tenant.IsInTrialPeriod ?
                        "TrialExpireNotification" :
                        "SubscriptionExpireNotification",
                        Model.LoginInformations.Tenant.GetSubscriptionExpiringDayCount())
                </span>
            </a>
        }
    }
}
